package com.webdesign.action;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.webdesign.dto.UserHomeworkDTO;
import com.webdesign.service.ITbDisplyService;
import com.webdesign.service.ITbUserhomeworkService;

@Controller("DisplayAction")
@Scope("prototype")
public class DisplayAction extends ActionSupport{
	private ITbUserhomeworkService iTbUserhomeworkService;
	
	private ITbDisplyService iTbDisplayService;
	
	private String[] userhomeworkids;
	
	private String userhomeworkid;
	
	private String comment;
	
	private String classify;
	
	private Boolean flag;
	
	private List<UserHomeworkDTO> userhomeworks;
	
	//查看已交作业页面点击加入展示列表点击提交跳转到这里
	public String redirectDisplay(){
		userhomeworks = iTbUserhomeworkService.returnUserhomework(userhomeworkids);
		return SUCCESS;
	}
	
	//添加展示作业，ajax异步消息，不跳转
	public String addDisplay(){
		flag = iTbDisplayService.addDisplay(userhomeworkid, comment, classify);
		return SUCCESS;
	}

	public ITbUserhomeworkService getiTbUserhomeworkService() {
		return iTbUserhomeworkService;
	}

	@Resource(name="TbUserhomeworkService")
	public void setiTbUserhomeworkService(
			ITbUserhomeworkService iTbUserhomeworkService) {
		this.iTbUserhomeworkService = iTbUserhomeworkService;
	}
	
	

	public ITbDisplyService getiTbDisplayService() {
		return iTbDisplayService;
	}

	@Resource(name="TbDisplyService")
	public void setiTbDisplayService(ITbDisplyService iTbDisplayService) {
		this.iTbDisplayService = iTbDisplayService;
	}

	public String[] getUserhomeworkids() {
		return userhomeworkids;
	}
	

	public void setUserhomeworkids(String[] userhomeworkids) {
		this.userhomeworkids = userhomeworkids;
	}

	public String getUserhomeworkid() {
		return userhomeworkid;
	}

	public void setUserhomeworkid(String userhomeworkid) {
		this.userhomeworkid = userhomeworkid;
	}

	public String getComment() {
		return comment;
	}

	public void setComment(String comment) {
		this.comment = comment;
	}

	public String getClassify() {
		return classify;
	}

	public void setClassify(String classify) {
		this.classify = classify;
	}

	public Boolean getFlag() {
		return flag;
	}

	public void setFlag(Boolean flag) {
		this.flag = flag;
	}

	public List<UserHomeworkDTO> getUserhomeworks() {
		return userhomeworks;
	}

	public void setUserhomeworks(List<UserHomeworkDTO> userhomeworks) {
		this.userhomeworks = userhomeworks;
	}
	
	
	
}
